<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        margin: 0;
        padding: 0;
        margin-top: 20px;
    }
    
    body {
        margin-left: 35%;
        margin-right: 35%;
        margin-top: 15%;
        text-align: center;
        border: 1px skyblue solid;
    }
    
    .style {
        text-decoration: underline;
    }
</style>

<body>

    <p>什么是JavaScript</p>
    <p>JavaScript是一门功能强大的编程语言</p>
    <h2 class="style">一起来学习JavaScript程序设计</h2>
    <p>JavaScript的发展历史</p>
    <input type="button" value="删除所有p">
    <script>
        var ps = document.querySelectorAll('p');
        var btn = document.querySelector('input');
        /* console.log(ps);
         console.log(btn);*/
        btn.onclick = function() {

            for (var i = 0; i < ps.length; i++) {
                ps[i].parentNode.removeChild(ps[i]);
            }
        }
    </script>

</body>

</html>